namespace classifier_test
{

namespace vem
{

class vem_concept_clustering : public concept_clustering
{
public:
	vem_concept_clustering();
	vem_concept_clustering(const vem_concept_clustering& Val);
	smart_ptr<concept_clustering> clone() const;

	void set_chunk_count(int Val);
	void set_chunk(int I, smart_ptr<validation_dataset> VDataset, smart_ptr<validation_classifier> VClassifier, double VError);
	void compute();
	const chunk& get_chunk(int I) const;
	int get_concept_count() const;
	const concept& get_concept(int I) const;
	const vector<int>& get_iteration_concept_counts() const;
	const vector<double>& get_iteration_errors() const;

private:
	struct my_concept : public concept
	{
		vector<int> chunks;
	};
	struct my_chunk : public chunk
	{
		smart_ptr<validation_dataset> vdataset;
		smart_ptr<validation_classifier> vclassifier;
		double verror;
		my_concept* concept_ptr;
	};

	vector<my_chunk> Chunks;
	vector<smart_ptr<my_concept> > Concepts;
	vector<int> IterConceptCounts;
	vector<double> IterErrors;

	void cluster_chunks();
	bool perform_assignment();
	void update_model();

	smart_ptr<my_concept> new_single_concept(int ChunkID);
	bool better_concept(int ConA, double ErrorA, int ConB, double ErrorB);
	double get_current_error();
};

}

}
